using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace SpellingQuiz
{
    public partial class InkEntryForm : Form
    {
        private SpellingEntryPanel currentEntryPanel;

        public InkEntryForm()
        {
            InitializeComponent();
        }

        public SpellingEntryPanel CurrentEntryPanel
        {
            get { return currentEntryPanel; }
            set
            {
                if (currentEntryPanel != null)
                    currentEntryPanel.Deactivate();

                currentEntryPanel = value;

                if (currentEntryPanel != null)
                    currentEntryPanel.Activate();
            }
        }

        private void nextButton_Click(object sender, EventArgs e)
        {
            string text = inkPanel1.RecoString;

            if( text != null ) currentEntryPanel.QuizTextBox.Text = text;
            inkPanel1.ClearInk();

            // Move to next
            currentEntryPanel.ParentForm.Focus();
            currentEntryPanel.SelectNextControl(currentEntryPanel, true, true, true, true);
            this.Focus();
        }

        private void prevButton_Click(object sender, EventArgs e)
        {
            string text = inkPanel1.RecoString;

            if( text != null ) currentEntryPanel.QuizTextBox.Text = text;
            inkPanel1.ClearInk();

            //Move to previous
            currentEntryPanel.ParentForm.Focus();
            currentEntryPanel.SelectNextControl(currentEntryPanel, false, true, true, true);
            this.Focus();
        }

        private void clearButton_Click(object sender, EventArgs e)
        {
            inkPanel1.ClearInk();
        }

        private void inkPanel1_Load(object sender, EventArgs e)
        {

        }
    }
}